       <script type="text/javascript" src="script/calendar.php?lang="></script>
<link href="script/calendar/calendar.css" rel="stylesheet" type="text/css" />

<?php if(!isset($r['flag'])&&empty($r['flag'])){?>
    <form action="<?php e_page("money","index")?>" method="get">
    <fieldset>
        <legend></legend>
        <label for="event_types">信息类型</label>
        <select name="event_types" id="event_types">
            <option value="">所有</option>
            <?php foreach($r['event_types'] as $k=>$v){?>
                <option value="<?php echo $k?>" <?php if($r['type']==$k) echo 'selected';?>><?php echo $v?></option>
            <?php }?>
        </select>
<!--        <input type="hidden" name="event_type" id="event_type" value="--><?php //echo $r['type'] ?><!--">-->
        <label for="username">用户名</label>
        <input type="text" name="username" id="username" placeholder="请输入用户名">

<input name="start_time" type="text" id="start_time" size="10" value="<?php echo $r['start_time']; ?>" readonly="readonly" style="width:120px" />
 <input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('start_time', '%Y-%m-%d', false, false, 'selbtn1');" value="选择开始时间" class="button"/>
 
 
 <input name="end_time" type="text" id="end_time" size="10" value="<?php echo $r['end_time']; ?>" readonly="readonly"  style="width:120px"/>
 <input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('end_time', '%Y-%m-%d', false, false, 'selbtn2');" value="选择结束时间" class="button"/>
 
        
        <input type="submit" value="搜索">
    </fieldset>
    </form>
<?php }?>

<a href="<?php e_action("download","event_types={$r['type']}&username={$r['username']}&start_time={$r['start_time']}&end_time={$r['end_time']}");?>">
    <input type="button" value="导出" style="background: #f00;color: #fff;border: none;padding: 3px 10px;border-radius: 4px;margin-bottom: 5px;" ></a>

<?php if(isset($r['flag'])&&!empty($r['flag'])){?>
    <form action="<?php e_page("member","tradeDetail")?>" method="get">
        <fieldset>
            <legend></legend>
            <input type="hidden" name="user_id" id="user_id" value="<?php echo $r['user_id'] ?>">
        </fieldset>
    </form>
<?php }?>


 
<table id="dataTable">
    <thead>
    <tr>
        <th width="123">ID</th>
        <th width="12%">用户名</th>
        <th>事件</th>
        <th>备注</th>
        <th>金额</th>
        <!--<th>余额</th>-->
        <th>事件类型</th>
<!--        <th>操作方式</th>-->
        <th>创建时间</th>
    </tr>
    </thead>
    <tbody>
    <?php foreach($r['money_info'] as $v){?>
        <tr>
            <td><?php echo $v['id'];?></td>
            <td><?php echo $r[$v['user_id']]['user_id'];?></td>
            <td><?php echo $v['event'];?></td>
<!--            <td>--><?php //echo $v['remark'];?><!--</td>-->
            <td><?php if(mb_strlen($v['remark'])<21)
                    echo $v['remark'];
                else{
                    echo mb_substr($v['remark'],0,19,"UTF-8");
                    echo "<br/>";
                    echo mb_substr($v['remark'],19,24,"UTF-8");
                    echo "<br/>";
                    echo mb_substr($v['remark'],43,80,"UTF-8");
                }?></td>
            <td>￥<?php echo $v['money'];?></td>
            <!--<td><?php //echo $v['total'];?></td>-->
            <td><?php foreach($r['event_type'] as $k=>$s){?>
                <?php if($v['event_type']==$k)echo $s;?>
            <?php }?></td>
<!--            <td>--><?php //foreach($r['pay_type'] as $k=>$s){?>
<!--                    --><?php //if($v['pay_type']==$k){?>
<!--                --><?php //if(isset($v['trade_no'])&&!empty($v['trade_no']))echo $s."充值（订单号：".$v['trade_no']."）";else echo $s;}?>
<!--                --><?php //}?><!--</td>-->
            <td><?php echo $v['create_time'];?></td>
        </tr>
    <?php }?>
    </tbody>
</table>
<?php
/** @var Page $page */
$page=$r['pages'];
?>
<?php echo $page->getPageHtml(); ?>